home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / CFM-68K SDK / Interfaces / MixedMode.a < prev    next >
Encoding:
Text File  |  1997-03-17  |  8.2 KB  |  282 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        MixedMode.a
  3. ;
  4. ;    Contains:    Mixed Mode Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.2.5
  8. ;
  9. ;    Copyright:    © 1984-1997 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  21. __MIXEDMODE__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29. kRoutineDescriptorVersion        EQU        7
  30.  
  31. ; MixedModeMagic Magic Cookie/Trap number 
  32. _MixedModeMagic                    EQU        $AAFE
  33.  
  34. ; Calling Conventions 
  35. ; typedef unsigned short     CallingConventionType
  36.  
  37. kPascalStackBased                EQU        0
  38. kCStackBased                    EQU        1
  39. kRegisterBased                    EQU        2
  40. kD0DispatchedPascalStackBased    EQU        8
  41. kD1DispatchedPascalStackBased    EQU        12
  42. kD0DispatchedCStackBased        EQU        9
  43. kStackDispatchedPascalStackBased EQU        14
  44. kThinkCStackBased                EQU        5
  45.  
  46. ; ISA Types 
  47. ; typedef SInt8             ISAType
  48.  
  49. kM68kISA                        EQU        0
  50. kPowerPCISA                        EQU        1
  51.  
  52. ; RTA Types 
  53. ; typedef SInt8             RTAType
  54.  
  55. kOld68kRTA                        EQU        (0 << 4)
  56. kPowerPCRTA                        EQU        (0 << 4)
  57. kCFM68kRTA                        EQU        (1 << 4)
  58.  
  59. kRegisterD0                        EQU        0
  60. kRegisterD1                        EQU        1
  61. kRegisterD2                        EQU        2
  62. kRegisterD3                        EQU        3
  63. kRegisterD4                        EQU        8
  64. kRegisterD5                        EQU        9
  65. kRegisterD6                        EQU        10
  66. kRegisterD7                        EQU        11
  67. kRegisterA0                        EQU        4
  68. kRegisterA1                        EQU        5
  69. kRegisterA2                        EQU        6
  70. kRegisterA3                        EQU        7
  71. kRegisterA4                        EQU        12
  72. kRegisterA5                        EQU        13
  73. kRegisterA6                        EQU        14
  74. ; A7 is the same as the PowerPC SP 
  75. kCCRegisterCBit                    EQU        16
  76. kCCRegisterVBit                    EQU        17
  77. kCCRegisterZBit                    EQU        18
  78. kCCRegisterNBit                    EQU        19
  79. kCCRegisterXBit                    EQU        20
  80.  
  81. ; typedef unsigned short     registerSelectorType
  82. ; SizeCodes we use everywhere 
  83.  
  84. kNoByteCode                        EQU        0
  85. kOneByteCode                    EQU        1
  86. kTwoByteCode                    EQU        2
  87. kFourByteCode                    EQU        3
  88.  
  89. ; Mixed Mode Routine Records 
  90. ; typedef unsigned long     ProcInfoType
  91. ; Routine Flag Bits 
  92. ; typedef unsigned short     RoutineFlagsType
  93.  
  94. kProcDescriptorIsAbsolute        EQU        $00
  95. kProcDescriptorIsRelative        EQU        $01
  96.  
  97. kFragmentIsPrepared                EQU        $00
  98. kFragmentNeedsPreparing            EQU        $02
  99.  
  100. kUseCurrentISA                    EQU        $00
  101. kUseNativeISA                    EQU        $04
  102.  
  103. kPassSelector                    EQU        $0
  104. kDontPassSelector                EQU        $08
  105.  
  106. kRoutineIsNotDispatchedDefaultRoutine EQU        $0
  107. kRoutineIsDispatchedDefaultRoutine EQU        $10
  108.  
  109. RoutineRecord             RECORD    0
  110. procInfo                 ds.l   1        ; offset: $0 (0)        ; calling conventions 
  111. reserved1                 ds.b   1        ; offset: $4 (4)        ; Must be 0 
  112. ISA                         ds.b   1        ; offset: $5 (5)        ; Instruction Set Architecture 
  113. routineFlags             ds.w   1        ; offset: $6 (6)        ; Flags for each routine 
  114. procDescriptor             ds.l   1        ; offset: $8 (8)        ; Where is the thing we’re calling? 
  115. reserved2                 ds.l   1        ; offset: $C (12)        ; Must be 0 
  116. selector                 ds.l   1        ; offset: $10 (16)        ; For dispatched routines, the selector 
  117. sizeof                     EQU *            ; size:   $14 (20)
  118.                         ENDR
  119.  
  120. ; typedef struct RoutineRecord  RoutineRecord
  121. ; typedef RoutineRecord     *RoutineRecordPtr, **RoutineRecordHandle
  122. ; Mixed Mode Routine Descriptors 
  123. ; Definitions of the Routine Descriptor Flag Bits 
  124. ; typedef UInt8             RDFlagsType
  125.  
  126. kSelectorsAreNotIndexable        EQU        $00
  127. kSelectorsAreIndexable            EQU        $01
  128.  
  129. ; Routine Descriptor Structure 
  130. RoutineDescriptor         RECORD    0
  131. goMixedModeTrap             ds.w   1        ; offset: $0 (0)        ; Our A-Trap 
  132. version                     ds.b   1        ; offset: $2 (2)        ; Current Routine Descriptor version 
  133. routineDescriptorFlags     ds.b   1        ; offset: $3 (3)        ; Routine Descriptor Flags 
  134. reserved1                 ds.l   1        ; offset: $4 (4)        ; Unused, must be zero 
  135. reserved2                 ds.b   1        ; offset: $8 (8)        ; Unused, must be zero 
  136. selectorInfo             ds.b   1        ; offset: $9 (9)        ; If a dispatched routine, calling convention, else 0 
  137. routineCount             ds.w   1        ; offset: $A (10)        ; Number of routines in this RD 
  138. routineRecords             ds     RoutineRecord ; offset: $C (12)    ; The individual routines 
  139. sizeof                     EQU *            ; size:   $20 (32)
  140.                         ENDR
  141.  
  142. ; typedef struct RoutineDescriptor  RoutineDescriptor
  143. ; typedef RoutineDescriptor  *RoutineDescriptorPtr, **RoutineDescriptorHandle
  144.  
  145. ;  68K MixedModeStateRecord 
  146. MixedModeStateRecord    RECORD 0
  147. state1                     ds.l    1                ; offset: $0 (0)
  148. state2                     ds.l    1                ; offset: $4 (4)
  149. state3                     ds.l    1                ; offset: $8 (8)
  150. state4                     ds.l    1                ; offset: $C (12)
  151. sizeof                     EQU *                    ; size:   $10 (16)
  152.                         ENDR
  153. ; Calling Convention Offsets 
  154. kCallingConventionWidth            EQU        4
  155. kCallingConventionPhase            EQU        0
  156. kCallingConventionMask            EQU        $F
  157. ; Result Offsets 
  158. kResultSizeWidth                EQU        2
  159. kResultSizePhase                EQU        kCallingConventionWidth
  160. kResultSizeMask                    EQU        $30
  161. ; Parameter offsets & widths 
  162. kStackParameterWidth            EQU        2
  163. kStackParameterPhase            EQU        (kCallingConventionWidth + kResultSizeWidth)
  164. kStackParameterMask                EQU        $FFFFFFC0
  165. ; Register Result Location offsets & widths 
  166. kRegisterResultLocationWidth    EQU        5
  167. kRegisterResultLocationPhase    EQU        (kCallingConventionWidth + kResultSizeWidth)
  168. ; Register Parameter offsets & widths 
  169. kRegisterParameterWidth            EQU        5
  170. kRegisterParameterPhase            EQU        (kCallingConventionWidth + kResultSizeWidth + kRegisterResultLocationWidth)
  171. kRegisterParameterMask            EQU        $7FFFF800
  172. kRegisterParameterSizePhase        EQU        0
  173. kRegisterParameterSizeWidth        EQU        2
  174. kRegisterParameterWhichPhase    EQU        kRegisterParameterSizeWidth
  175. kRegisterParameterWhichWidth    EQU        3
  176. ; Dispatched Stack Routine Selector offsets & widths 
  177. kDispatchedSelectorSizeWidth    EQU        2
  178. kDispatchedSelectorSizePhase    EQU        (kCallingConventionWidth + kResultSizeWidth)
  179. ; Dispatched Stack Routine Parameter offsets 
  180. kDispatchedParameterPhase        EQU        (kCallingConventionWidth + kResultSizeWidth + kDispatchedSelectorSizeWidth)
  181. ; Special Case offsets & widths 
  182. kSpecialCaseSelectorWidth        EQU        6
  183. kSpecialCaseSelectorPhase        EQU        kCallingConventionWidth
  184. kSpecialCaseSelectorMask        EQU        $3F0
  185. ; Component Manager Special Case offsets & widths 
  186. kComponentMgrResultSizeWidth    EQU        2
  187. kComponentMgrResultSizePhase    EQU        kCallingConventionWidth + kSpecialCaseSelectorWidth ; 4 + 6 = 10 
  188. kComponentMgrParameterWidth        EQU        2
  189. kComponentMgrParameterPhase        EQU        kComponentMgrResultSizePhase + kComponentMgrResultSizeWidth ; 10 + 2 = 12 
  190.  
  191. kSpecialCase                    EQU        $0000000F
  192.  
  193. ; all of the special cases enumerated.  The selector field is 6 bits wide 
  194. kSpecialCaseHighHook            EQU        0
  195. kSpecialCaseCaretHook            EQU        0                    ; same as kSpecialCaseHighHook 
  196. kSpecialCaseEOLHook                EQU        1
  197. kSpecialCaseWidthHook            EQU        2
  198. kSpecialCaseTextWidthHook        EQU        2                    ; same as kSpecialCaseWidthHook 
  199. kSpecialCaseNWidthHook            EQU        3
  200. kSpecialCaseDrawHook            EQU        4
  201. kSpecialCaseHitTestHook            EQU        5
  202. kSpecialCaseTEFindWord            EQU        6
  203. kSpecialCaseProtocolHandler        EQU        7
  204. kSpecialCaseSocketListener        EQU        8
  205. kSpecialCaseTERecalc            EQU        9
  206. kSpecialCaseTEDoText            EQU        10
  207. kSpecialCaseGNEFilterProc        EQU        11
  208. kSpecialCaseMBarHook            EQU        12
  209. kSpecialCaseComponentMgr        EQU        13
  210.  
  211.     IF GENERATINGCFM  THEN
  212. ;
  213. ; pascal UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)
  214. ;
  215.     IF ¬ GENERATINGCFM THEN
  216.         Macro
  217.         _NewRoutineDescriptor
  218.             moveq    #0,d0
  219.             dc.w     $AA59
  220.         EndM
  221.     ELSE
  222.         IMPORT_CFM_FUNCTION    NewRoutineDescriptor
  223.     ENDIF
  224.  
  225. ;
  226. ; pascal void DisposeRoutineDescriptor(UniversalProcPtr theProcPtr)
  227. ;
  228.     IF ¬ GENERATINGCFM THEN
  229.         Macro
  230.         _DisposeRoutineDescriptor
  231.             moveq    #1,d0
  232.             dc.w     $AA59
  233.         EndM
  234.     ELSE
  235.         IMPORT_CFM_FUNCTION    DisposeRoutineDescriptor
  236.     ENDIF
  237.  
  238. ;
  239. ; pascal UniversalProcPtr NewFatRoutineDescriptor(ProcPtr theM68kProc, ProcPtr thePowerPCProc, ProcInfoType theProcInfo)
  240. ;
  241.     IF ¬ GENERATINGCFM THEN
  242.         Macro
  243.         _NewFatRoutineDescriptor
  244.             moveq    #2,d0
  245.             dc.w     $AA59
  246.         EndM
  247.     ELSE
  248.         IMPORT_CFM_FUNCTION    NewFatRoutineDescriptor
  249.     ENDIF
  250.  
  251. ;
  252. ; pascal OSErr SaveMixedModeState(MixedModeStateRecord *stateStorage, UInt32 stateVersion)
  253. ;
  254.     IF ¬ GENERATINGCFM THEN
  255.         Macro
  256.         _SaveMixedModeState
  257.             moveq               #3,D0
  258.             dc.w                $AA59
  259.         EndM
  260.     ELSE
  261.         IMPORT_CFM_FUNCTION SaveMixedModeState
  262.     ENDIF
  263.  
  264. ;
  265. ; pascal OSErr RestoreMixedModeState(MixedModeStateRecord *stateStorage, UInt32 stateVersion)
  266. ;
  267.     IF ¬ GENERATINGCFM THEN
  268.         Macro
  269.         _RestoreMixedModeState
  270.             moveq               #4,D0
  271.             dc.w                $AA59
  272.         EndM
  273.     ELSE
  274.         IMPORT_CFM_FUNCTION RestoreMixedModeState
  275.     ENDIF
  276.  
  277.     ELSE
  278.     ENDIF
  279.     IF CFMSYSTEMCALLS  THEN
  280.     ENDIF
  281.     ENDIF ; __MIXEDMODE__
  282.